/*
 * Copyright 2020-2030 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/
package com.woodws.fresh.im.api.service

import com.woodws.fresh.common.core.domain.R
import com.woodws.fresh.common.core.service.BaseService
import com.woodws.fresh.im.api.dto.ImMessageDto

/**
 * 消息表业务接口
 * @author maoxiaodong
*/
interface ImMessageService: BaseService<ImMessageDto>{

    /**
     * 最后消息对象
     * @param num 查询数量
     */
    fun findByFromIdGroupByToId(fromId: Long, num: Long = 10): R<List<ImMessageDto>>

    /**
     * 查询聊天信息
     * @param fromId 我的ID
     * @param toId 好友ID
     */
    fun findByFromIdAndToId(fromId: Long, toId: Long): R<List<ImMessageDto>>

    /**
     * 未读的信息
     * @param 接收人ID
     */
    fun findUnreadByToId(toId: Long): R<List<ImMessageDto>>

    /**
     * 根据id更新状态
     * @param id 主键
     * @param status 状态
     */
    fun updateStatusById(id: Long, status: String): R<Int>
}